Release 10.1A: OpenEdge Data Management:
DataServer for Microsoft SQL Server
Run Stored-Procedure statement
The
RUN STORED-PROCstatement runs a RDBMS stored procedure or allows you to send Transact-SQL to a MS SQL Server based data source using an OpenEdge DataServer. It contains aprocedure-namewhich is either the:
- Name of the RDBMS stored procedure that you want to run.
Note: If your 4GL procedure is in a transaction block when a- Progress built-in procedure name,
send–sql–statement, to send Transact-SQL to a MS SQL Server based data source.RUNSTORED–PROCEDUREstatement is executed, the RDBMS stored procedure runs within the same RDBMS transaction, even if your stored procedure declares its own transaction levels.LOAD-RESULT-INTO phrase
The
LOAD-RESULT-INTOfunction loads the result sets into a temp-table which is represented by a handle variable. Note that handle can also be defined as extent to enable you to pass more than one temp-table handle in those instances where SQL statement(s) are defined to return more than one result set.When used with the
Note: The Progress compiler issues an error at runtime if the variable of type handle with theRUN STORED-PROCstatement or stored procedure to load result sets into Progress temp-tables, this function carries an implicitCLOSE-STORED PROCEDUREstatement.LOAD-RESULT-INTOfunction does not point to a temp-table.For additional details about using the
LOAD-RESULT-INTOphrase with the temp-table handle, see the "Loading result sets into temp-tables" section.When used with the
LOAD-RESULT-INTOphrase, the Temp-Table handle identifies the temp-table to which the result set will be loaded.You can specify an array of one or more temp-table handle elements to retrieve stored procedure result sets and have the DataServer load the result set data directly into the associated temp-table(s). This approach allows you to have direct 4GL access to the fields defined in the temp-table.
The following types of temp-tables can support result sets:
For additional details about using the
LOAD-RESULT-INTOphrase with the temp-table handle, see "Loading result sets into temp-tables" section.PROC-STATUS phrase
The
PROC-STATUSphase returns the return status from a MS SQL Server stored procedure. The return status is an integer value that typically indicates whether a stored procedure succeeded or failed; if it failed, a code indicating why it failed. See your SQL Server documentation for descriptions of the possible values for the return status.PROC-HANDLE phrase
The
PROC-HANDLEphrase allows you to specify a handle to act as a unique identifier for an MS SQL DataServer stored procedure. For example, thePROC-HANDLEassigns a value to the specified integer field or variable (integer–field) that uniquely identifies the stored procedure that is returning results from SQL Server.Note these additional points about the
PROC-HANDLE:NO-ERROR option
The
Note: This option must appear before any runtime parameter list.NO-ERRORoption specifies that anyERRORcondition that theRUNSTORED–PROCEDUREstatement produces is suppressed. Before you close a stored procedure, check theERROR–STATUShandle for information on any errors that occurred. You receive an error when you attempt to close a stored procedure that did not start.PARAM phrase
The
Paramphrase identifies a run-time parameter to be passed to the stored procedure. Aparameterhas the following syntax:
An
Note: When you runexpressionis a constant, field name, variable name, or expression.INPUTis the default.OUTPUTandINPUT–OUTPUTparameters must be record fields or program variables.send–sql–statementfor a MS SQL-based data source, it passes a single character expressionparametercontaining the SQL statement you want the data source to execute.If you do not specify
parameter–name(the name of a keyword parameter defined by the stored procedure), you must supply all of the parameters in correct order. If you do specifyparameter–name, you must precede your assignment statement with the keywordPARAM. If you do not supply a required parameter, and no default is specified in the stored procedure, you receive a run-time error.
|
Copyright © 2005 Progress Software Corporation www.progress.com Voice: (781) 280-4000 Fax: (781) 280-4095 |